<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    var list = [1, 4, 7, 2, 5, 8, 3, 6, 9];
    list.sort((a, b) => a - b);
    // a-b>0   a>b  前一个大于后一个时交换位置 -> 从小到大
    // b-a>0   a<b  前一个小于后一个时交换位置 -> 从大到小

    var list = [
        { name: "张三", class: "2204", chinese: 55, math: 100, english: 95 },
        { name: "李四", class: "2204", chinese: 72, math: 77, english: 72 },
        { name: "王五", class: "2204", chinese: 65, math: 99, english: 84 },
        { name: "小六", class: "2204", chinese: 84, math: 66, english: 79 },
    ]

    list.sort((a,b)=>a.chinese - b.chinese);
    console.log(list);




</script>

</html>